#include "videoprocessorthread.h"
//初始化列表中初始化线程
VideoProcessorThread::VideoProcessorThread(QObject *parent) : QThread(parent)
{
}
//重写run
void VideoProcessorThread::run()
{
    using namespace cv;
    VideoCapture camera(0);
    Mat inFrame, outFrame;
    while(camera.isOpened() && !isInterruptionRequested())  //相机打开且无中断请求
    {
        camera >> inFrame;
        if(inFrame.empty())  continue;

        bitwise_not(inFrame, outFrame);     //按位取反
        //发送显示图像的信号（信号含参）
        emit inDisplay( QPixmap::fromImage( QImage(inFrame.data,inFrame.cols,inFrame.rows,inFrame.step,QImage::Format_RGB888).rgbSwapped()));
        emit outDisplay(QPixmap::fromImage(QImage(outFrame.data,outFrame.cols,outFrame.rows,outFrame.step,QImage::Format_RGB888).rgbSwapped()));
    }
}
